import { getFlowOrgTreeByOrgIDService } from '@/services/BaseLayout';
import { warnManageService } from '../services';
import { useEffect } from 'react';
import { handleNotPostion } from '@/pages/ContractController/ContractManage/mconfig';

const ManageSearchColumns = () => {
  // 1.获取树形数据-仓库名称
  const { treeLoading, treeData, reloadRefresh } = warnManageService();
  /** 获取组织机构树接口 */
  const { getFlowOrgTreeRun, getFlowOrgTreeLoading, getFlowOrgList } = getFlowOrgTreeByOrgIDService();
  useEffect(() => {
    let payload = {
      params: '0',
      flowType: '0',
    };
    getFlowOrgTreeRun(payload);
  }, []);
  const tempArr = [
    {
      name: 'applyCode',
      placeholder: '流水号',
      label: '流水号',
      componentType: 'Input',
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'type',
      placeholder: '出入库类型',
      label: '出入库类型',
      componentType: 'Select',
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
      dataSource: [
        { value: '0', name: '领用出库' },
        { value: '1', name: '调剂入库' },
        { value: '2', name: '调剂出库' },
        { value: '3', name: '退回入库' },
        { value: '4', name: '登记入库' },
      ],
    },
    {
      name: 'createDepartmentID',
      placeholder: '所属部门',
      label: '所属部门',
      componentType: 'TreeSelect',
      allowClear: true,
      md: 5,
      sm: 24,
      treeID: 'id',
      treeName: 'text',
      whetherSenior: false,
      dataSource: handleNotPostion(getFlowOrgList),
      // fieldNames: {
      //   label: 'text',
      //   value: 'id',
      //   children: 'children',
      // }
    },
    {
      name: 'createTime',
      placeholder: '出入库',
      label: '',
      componentType: 'RangePicker',
      allowClear: true,
      md: 9,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'Date',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
  ];

  return tempArr;
};

export { ManageSearchColumns };
